<?php

namespace App\Http\Controllers\Weixiao;

use App\Http\Helpers\Sign;
use App\Jobs\FacePushJob;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Services\FaceService;

class FaceController extends Controller
{
    /**
     *人脸接收接口
     * @author lican<364548233@qq.com>
     */
    public function index(Request $request){
        $data = $request->except('s');
        Sign::writeLog('人脸推送：', $data, 'face');

        dispatch(new FacePushJob($data, false));

        return json_encode(['result' => 1, 'msg' => 'ok']);
    }

    /**
     *人脸列表
     * @author: lican<364548233@qq.com>
     */
    public function list(Request $request){

        $keyword = trim($request->input('keyword'));
        $page = $request->input('page') ?? 1;
        $pageSize = $request->input('pageSize') ?? 10;
        $res = FaceService::list($keyword, $page, $pageSize);
        return $res;
    }

}

